package com.smart.community.property.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.*;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 维修工单工作管理扩展DTO
 *
 * @author Wu.Liang
 * @since 2025-01-30
 * @version 1.0.0
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "维修工单工作管理扩展DTO")
public class RepairOrderWorkDTO extends RepairOrderDTO {

    @Schema(description = "物业公司ID", example = "1")
    @NotNull(message = "物业公司ID不能为空")
    private Long propertyCompanyId;

    @Schema(description = "维修人员姓名", example = "张三")
    private String repairmanName;

    @Schema(description = "维修人员电话", example = "13800138000")
    private String repairmanPhone;

    @Schema(description = "维修人员部门", example = "维修部")
    private String repairmanDepartment;

    @Schema(description = "预计完成时间", example = "2025-01-31 18:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime estimatedCompleteTime;

    @Schema(description = "实际开始时间", example = "2025-01-30 09:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime actualStartTime;

    @Schema(description = "维修材料清单", example = "[\"螺丝刀\", \"扳手\", \"电线\"]")
    private List<String> materialList;

    @Schema(description = "维修费用", example = "150.00")
    @DecimalMin(value = "0.0", message = "维修费用不能为负数")
    private java.math.BigDecimal repairCost;

    @Schema(description = "工时（小时）", example = "2.5")
    @DecimalMin(value = "0.0", message = "工时不能为负数")
    private java.math.BigDecimal workHours;

    @Schema(description = "维修结果描述", example = "已修复门锁，更换了损坏的零件")
    @Size(max = 500, message = "维修结果描述不能超过500个字符")
    private String repairResult;

    @Schema(description = "客户满意度", example = "5")
    @Min(value = 1, message = "客户满意度最低为1分")
    @Max(value = 5, message = "客户满意度最高为5分")
    private Integer customerSatisfaction;

    @Schema(description = "客户评价", example = "维修师傅很专业，服务态度很好")
    @Size(max = 200, message = "客户评价不能超过200个字符")
    private String customerComment;

    @Schema(description = "是否需要回访", example = "true")
    private Boolean needFollowUp = false;

    @Schema(description = "回访时间", example = "2025-02-01 10:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime followUpTime;

    @Schema(description = "回访结果", example = "客户满意，无需进一步处理")
    @Size(max = 200, message = "回访结果不能超过200个字符")
    private String followUpResult;

    @Schema(description = "工单来源", example = "1")
    private Integer source;

    @Schema(description = "工单来源名称", example = "业主报修")
    private String sourceName;

    @Schema(description = "是否紧急工单", example = "false")
    private Boolean isUrgent = false;

    @Schema(description = "工单标签", example = "[\"紧急\", \"重要\"]")
    private List<String> tags;

    @Schema(description = "关联工单ID", example = "123")
    private Long relatedOrderId;

    @Schema(description = "工单分类", example = "1")
    private Integer category;

    @Schema(description = "工单分类名称", example = "设备维修")
    private String categoryName;

    @Schema(description = "维修地点详细描述", example = "A栋1单元101室客厅")
    @Size(max = 200, message = "维修地点详细描述不能超过200个字符")
    private String locationDetail;

    @Schema(description = "是否已通知客户", example = "true")
    private Boolean customerNotified = false;

    @Schema(description = "通知时间", example = "2025-01-30 08:30:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime notificationTime;

    @Schema(description = "通知方式", example = "1")
    private Integer notificationMethod;

    @Schema(description = "通知方式名称", example = "电话通知")
    private String notificationMethodName;
}
